﻿
#include "Widget.h"
#include "ui_Widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);

    movie = new QMovie(":/Res/image/wait.gif");
    movie->setParent(ui->UseWaitMovie);
    ui->UseWaitMovie->setMovie(movie);
    movie->start();

    time = new QLabel(ui->UseWaitMovie);
    time->setGeometry(10, 430, 200, 40);
    time->setStyleSheet("QLabel{font: 20px; color: rgb(25, 25, 112);}");
    signal = new QLabel(ui->UseWaitMovie);
    signal->move(700, 440);
    signal->resize(41, 22);
    signal->setStyleSheet("QLabel{background-color:transparent;}");

    ui->UseWaitHintButton->setFlat(true);
    ui->UseWaitpushButton->setFlat(true);

    connect(ui->UseWaitpushButton, SIGNAL(released()), this, SLOT(on_UseWaitpushButton_clicked()));
    connect(ui->UseWaitHintButton, SIGNAL(pressed()), this, SLOT(on_UseWaitHintButton_pressed()));
    connect(ui->UseWaitHintButton, SIGNAL(released()), this, SLOT(on_UseWaitHintButton_released()));
    connect(&this->timerLongPress, SIGNAL(timeout()), this, SLOT(onClickedLongCount()));
}

void Widget::on_UseWaitpushButton_clicked()
{
    /*待完成*/
    stackLayout->setCurrentIndex(ChooseGunPage);
}

void Widget::on_UseWaitHintButton_pressed()
{
    timerLongPress.start(3000);
}
void Widget::onClickedLongCount()
{
    timerLongPress.stop();
    /*待完成*/
    stackLayout->setCurrentIndex(deviceMaintaiceforLogingPage);
}
void Widget::on_UseWaitHintButton_released()
{
    timerLongPress.stop();
}


Widget::~Widget()
{
    delete ui;
}
